import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'Layout',
    redirect: '/pieChart',
    component: () => import('../layout/Layout.vue'),
    children: [
      {
        path: '/pieChart',
        name: 'PieChart',
        component: () => import('../views/PieChart.vue')
      },
      {
        path: '/home',
        name: 'Home',
        component: () => import('../views/Home.vue')
      },
      {
        path: '/files',
        name: 'Files',
        component: () => import('../views/Files.vue')
      },
      {
        path: '/article',
        name: 'Article',
        component: () => import('../views/Article.vue')
      },
      {
        path: '/im',
        name: 'Im',
        component: () => import('../views/Im.vue')
      },
      {
        path: '/message',
        name: 'Message',
        component: () => import('../views/Message.vue')
      },
      {
        path: '/contact',
        name: 'Contact',
        component: () => import('../views/Contact.vue')
      },
      {
        path: '/personInfo',
        name: 'PersonInfo',
        component: () => import('../views/PersonInfo.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
